package org.tc.shopmall.service.impl;

import Dto.OrdersDto;
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.tc.shopmall.entity.Orderdetails;
import org.tc.shopmall.entity.Orders;
import org.tc.shopmall.entity.PageHelper;
import org.tc.shopmall.mapper.OrdersMapper;
import org.tc.shopmall.service.OrderService;

import java.util.List;

@RestController
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrdersMapper ordersMapper;

    @Override
    public List<Orders> selectAllOrder(@RequestBody PageHelper pageHelper) {
        System.out.println("查询------------------------");
        return ordersMapper.selectAllOrder(pageHelper);
    }



    @Override
    public int insert(@RequestBody Orders record) {
        int count = ordersMapper.insert(record);
        return count;
    }


    @Override
    public int deleteByPrimaryKey(Integer id) {
        return ordersMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Orders selectByPrimaryKey(Integer id) {
        return ordersMapper.selectByPrimaryKey(id);
    }

    @Override
    public int selectCount() {
        return ordersMapper.selectCount();
    }

    @Override
    public int updateOrder(@RequestBody Orders orders) {
        System.out.println("修改");
        return ordersMapper.updateOrder(orders);
    }

    @Override
    public List<Orders> selectAllOrders() {
        return null;
    }

//    @Override
//    public int selectCountByshy(Integer salesclerkid) {
//        return ordersMapper.selectCountByshy(salesclerkid);
//    }

    @Override
    public double QueryMonth(String monthtime, String endtime, Integer storeid) {
        return ordersMapper.QueryMonth(monthtime, endtime, storeid);
    }

    @Override
    public double QueryDay(String endtime, Integer storeid) {
        return ordersMapper.QueryDay(endtime, storeid);
    }

    @Override
    public int QueryDayOrder(String monthtime, String endtime, Integer storeid) {
        return ordersMapper.QueryDayOrder(monthtime, endtime, storeid);
    }


    @Override
    public int QueryRorder(String endtime, Integer storeid) {
        return ordersMapper.QueryRorder(endtime, storeid);
    }



    @Override
    public List<Orders> selectAllDate(String createordertime, Integer id) {
        return null;
    }

    @Override
    public int getOrderLastId() {
        int count = ordersMapper.getOrderLastId();
        return count;
    }

    @Override
    public List<Orders> QueryAllOrders(Integer userid) {
        System.out.println("传入的参数："+userid);
        List<Orders> list = ordersMapper.QueryAllOrders(userid);
        System.out.println("查询结果条数："+list.size());
        return list;
    }
}
